<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>检索</title>
    <link rel="stylesheet" href="../css/common.css">
    <style>
        .main{
            position: absolute;
            top: 0;
            left: 0;
            bottom: 0;
            right: 0;
        }
        .bodyer{
            height: calc(100% - 130px);
            background: #fbfbfb url("../image/bg2.jpg")no-repeat;
            background-size: contain;
        }
        .header_t{
            border-bottom: 1px solid #3e93ff;
            background: #146ffb;
            /*background: red;*/
            height: 40px;
        }
        .header_b{
            height: 90px;
            width: 100%;
            background: url("../image/bg1.png")no-repeat;
            background-size: cover;
            background-position: center bottom;

        }
        .header_b>div{
            width: 65%;
            height: 100%;
            position: relative;
        }
        .header_b .news{
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(25,102,203,0.9);
            height: 40px;
        }
        .header_b .news>div{
            flex : 1;
        }
        .header_b .news>div>p{
            cursor: pointer;
            width: 100%;
            color: #ffffff;
            text-indent: 50px;
            justify-content: flex-start;
            font-size: 12px;
        }
        .header_b .news>div:nth-of-type(2)>p{
            border-left: 1px solid #ffffff;
        }
        p{
            margin:  0 ;
        }
        body .header_t_c{
            width: 65%;
            height: 100%;
            justify-content: space-between;
            color: #ffffff;
        }
        .header_t_c>div{
            height: 100%;
        }
        .header_t_c ul {
            height: 100%;
        }
        .header_t_c ul li{
            height: 100%;
            padding: 0px 15px;
            box-sizing: border-box;
        }
        .header_t_c ul li span{
            display: flex;
            height: 100%;
            cursor: pointer;
        }
        body .header_t_c ul .ul_active{
            border-bottom: 2px solid #ffffff;
            box-sizing: border-box;
        }
        .photo{
            width: 30px;
            height: 30px;
            background: url("../image/head.png");
            background-size: cover;
            border-radius: 50%;
        }
        .name{
            padding: 0px 10px;
        }
        .quit_btn{
            color: #72afff;
            font-style: normal;
            font-size: 12px;
            height: 100%;
            cursor: pointer;
        }
        .power{
            align-items: flex-start;
            padding-top: 20px;
            box-sizing: border-box;
            width: 65%;
            justify-content: space-between;
            height: 100%;
            /*overflow-y: scroll;*/
            /*background: red;*/
        }
        .power_l{
            width: 200px;
            /*background: blue;*/
            height: 100%;
        }
        .power_r{
            box-shadow: 2px 2px 2px #c7c7c7;
            width: calc(100% - 240px);
            background: #ffffff;
            /*height: 100%;*/
            padding: 10px;
            /*box-sizing: border-box;*/
        }
        .search,.browse{
            box-shadow: 2px 2px 2px #c7c7c7;
            background: #fff;
            border-radius: 2px;
            box-sizing: border-box;
            width: 100%;
            /*padding: 10px;*/
        }
        .browse{
            margin-top: 20px;
        }
        .search_i_2{
            display: inline-block;
            border: 2px solid #999999;
        }
        .search_title,.browse_title{
            padding-top: 6px;
            height: 40px;
            justify-content: flex-start;
            border-bottom: 1px solid #efefef;
        }
        .search_i_1{
            margin-left: 10px;
            width: 20px;
            height: 20px;
            background: url("../image/icon_10.png")no-repeat center center;
            background-size: cover;
        }
        .search_text{
            color: #333333;
            margin-left: 10px;
            font-size: 14px;
            font-weight: bold;
        }
        .search ul,.browse ul{
            padding:10px;
            box-sizing: border-box;
        }
        .search li,.browse li{
            cursor: pointer;
            padding: 10px 0px;
            justify-content: flex-start;
        }
        .search li span,.browse li span{
            color:#949697;
            margin-left: 10px;
            font-size: 14px;
        }

        .select_box p{
            /*color: #949697;*/
        }
        .select_content{
            position: absolute;
            left: -1px;
            right: 0;
            top: 38px;
            background: #fff;
            border: 1px solid #eaeaea;
        }
        .select_content1{
            display: none;
            position: absolute;
            left: -1px;
            right: 0;
            top: 38px;
            background: #fff;
            border: 1px solid #eaeaea;
        }
        .select_content1 div{
            line-height: 30px;
            text-align: center;
            color: #949697;
        }
        .select_content1 div:hover{
            background: #1772fa;
            color: #ffffff;
        }
        .select_content div{
            line-height: 30px;
            text-align: center;
            color: #949697;
        }
        .btn_box3 li input{
            width: calc(100% - 70px);
            height: 26px;
            box-sizing: border-box;
            outline: none;
            border: none;
            border-left: 1px solid #eaeaea;
            background: #fbfbfb;
            text-indent: 10px;
        }
        .header_b_main{
            width: 100%;
        }
        .search_box_t{
            justify-content: space-between;
        }
        .search_box{
            /*box-shadow: 2px 2px 2px #c7c7c7;*/
            border: 1px solid #eaeaea;
            box-sizing: border-box;
            padding: 20px 20px 20px 5px;
            background: #ffffff;
            width: 100%;
            /*height: 80px;*/
        }
        .search_box_t_main{
            justify-content: flex-start;
            width: calc(100% - 130px);
        }
        .search_box_t_main>div{
            height: 40px;
            background: #fbfbfb;
        }
        .select{
            cursor:pointer;
            font-size: 12px;
            color: #666666;
            justify-content: center;
            width: 60px;
            border-top-left-radius: 3px;
            border-bottom-left-radius: 3px;
        }
        input[type=text]{
            color: #666666;
            background: #fbfbfb;
            border: none;
            outline: none;
            font-size: 12px;
            border-left: 1px solid #e1e1e1;
            text-indent: 20px;
            width: 100%;
        }
        .input_box{
            width: calc(100% - 100px);
        }
        .search_box_t_main{
            box-sizing: border-box;
            border-radius: 2px;
            border: 1px solid #eaeaea;
            justify-content: flex-start;
            width: calc(100% - 130px);
        }

        .senior{
            font-size: 14px;
            cursor: pointer;
            width: 100px;
            height: 40px;
            justify-content:center ;
            background: rgba(25,102,203,0.9);
            color: #fff;
        }
        .icon_1_box{
            border-top-right-radius: 3px;
            border-bottom-right-radius: 3px;
            justify-content: center;
            cursor: pointer;
            width: 40px;
            height: 40px;
        }
        .vis_select{
            width: 30px;
            visibility: hidden;
        }
        .search_box_b{
            justify-content: flex-start;
        }
        .search_box_b>ul{
            width: calc(100% - 20px);
            overflow: hidden;
            white-space:nowrap;
            justify-content: flex-start;
        }
        .content{
            padding-bottom: 40px;
            align-items: flex-start;
            /*margin-top: 20px;*/
            justify-content: space-between;
        }
        .icon_1{
            width: 20px;
            height: 20px;
            background: url("../image/icon_1.png")no-repeat center center;
            background-size: cover;
        }
        input[type=checkbox]{
            margin: 0;
        }
        /*.search_box_b li{*/
            /*margin-left: 10px;*/
            /*height: 40px;*/
            /*color: #ffffff;*/
        /*}*/
        .search_box_b li{
            margin-left: 15px;
            height: 40px;
            color: #ffffff;
        }
        .search_box_b li span{
            color: #999999;
            margin-left: 5px;
            font-size: 12px;
        }
        li>input{
            margin: 0;
            width: 14px;
            height: 14px;
            outline: none;
            border: none;
        }
        .icon_2{
            margin-left: 5px;
            width: 6px;
            height: 4px;
            background: url("../image/icon_2.png")no-repeat center center;
            background-size: cover;
        }
        .icon_3{
            margin-left: 10px;
            width: 7px;
            height: 9px;
            background: url("../image/icon_3.png")no-repeat center center;
            background-size: cover;
        }
        .btn_box{
            padding: 15px 0px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .btn_box_r{
            padding-right: 10px;
            color: #999999;
            font-size: 12px;
        }
        .btn_box_r input{
            border: #999999;
        }
        .btn_box_r span{
            padding: 0 10px 0px 5px;
        }
        .my_i_4{
            width: 12px;
            height: 15px;
            background: url("../image/icon_13.png")no-repeat center center;
            background-size: cover;
        }
        .btn_box .title{
            font-size: 14px;
            font-weight: bold;
        }
        .table_box{
         
            min-height: 400px;
        }
        thead {
            background: #f7f7f7;
        }
        table th{
            text-align: center;
            font-size: 14px;
            line-height: 40px;
        }
        tr>td:nth-of-type(1){
            width: 35%;
        }
        tr>td:nth-of-type(2){
            width: 10%;
        }
        tr>td:nth-of-type(3){
            width: 15%;
        }
        tr>td:nth-of-type(4){
            width: 10%;
        }
        tr>td:nth-of-type(5){
            width: 5%;
        }
        tr>td:nth-of-type(6){
            width: 5%;
        }
        tr>td:nth-of-type(7){
            width: 10%;
        }
        tr>td:nth-of-type(8){
            width: 5%;
        }
        tr>td:nth-of-type(9){
            width: 5%;
        }
        th:nth-of-type(1){
            width: 35%;
        }
        th:nth-of-type(2){
            width: 10%;
        }
        th:nth-of-type(3){
            width: 15%;
        }
        th:nth-of-type(4){
            width: 10%;
        }
        th:nth-of-type(5){
            width: 5%;
        }
        th:nth-of-type(6){
            width: 5%;
        }
        th:nth-of-type(7){
            width: 10%;
        }
        th:nth-of-type(8){
            width: 5%;
        }
        th:nth-of-type(9){
            width: 5%;
        }
        body .table_box table td {
            /*justify-content: flex-start;*/
            text-align: center;
            font-size: 12px;
            color: #999999;
            line-height: 30px;
        }
        body .table_box table td span {
            text-align: left;
            display: inline-block;
            /*width: 150px;*/
            width: calc(100% - 30px);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        td:nth-of-type(1) {
            text-align: left;
            text-indent: 10px;
        }

        .icon4{
             width: 16px;
             height: 16px;
             background: url("../image/icon_16.png")no-repeat;
             background-size: cover;
             cursor: pointer;
         }

        .icon6{
            width: 13px;
            height: 18px;
            background: url("../image/icon_13.png")no-repeat;
            background-size: cover;
            cursor: pointer;
        }

        .icon5{
            width: 16px;
            height: 16px;
            background: url("../image/icon_11.png")no-repeat;
            background-size: cover;
            cursor: pointer;
        }


        .paging_box_{
            padding: 10px 10px 10px 0px;
            display: flex;
            justify-content: flex-end;
        }
        .power_mian {
            padding: 10px 0px;
            justify-content: flex-start;
            align-items: flex-start;
        }
        .btn_box2 {
            /*padding-top: 10px;*/
            width: 60px;
            justify-content: flex-start;
        }
        .btn_box2 div{
            height: 40px;
            margin-top: 10px;
        }
        .btn_box3 {
            width: calc(100% - 60px);
        }
        .btn_box2 button {
            outline: none;
            border: none;
            width: 20px;
            height: 20px;
            color: #1772fa;
            cursor: pointer;
            border: 1px solid #949697;
            border-radius: 2px;
        }
        .btn_box2 button:nth-of-type(2) {
            margin-left: 10px;
        }
        .btn_box2 button>img{
            width: 10px;
            height: 10px;
        }
        .btn_box3_ul li {
            margin-top: 10px;
        }
        .btn_box3 li>div {
            height: 40px;
            background: #fbfbfb;
            box-sizing: border-box;
            border: 1px solid #eaeaea;
            border-radius: 2px;
        }
        .btn_box3 li>div:nth-of-type(1) {
            width: 40%;
        }
        .btn_box3 li>div:nth-of-type(2) {
            width: 70px;
        }
        .btn_box3 li>div:nth-of-type(3) {
            width: 40%;
        }
        .btn_box_{
            justify-content: flex-end;
        }
        .common_btn,.submit{
            font-size: 14px;
            cursor: pointer;
            width: 100px;
            height: 40px;
            justify-content: center;
            background: rgba(25,102,203,0.9);
            color: #fff;
        }
        .common_btn{
            margin-left: 10px;
        }
        td{
            display: flex;
            justify-content: space-around;
            align-items: center;
        }
        td>p{
            width: 100%;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }
        tr{
            width: 100%;
            display: flex;
        }
        table,thead,tbody{
            width: 100%;
            display: inline-block;
        }

    </style>
</head>
<body>
<div class="main">
    <div class="header">
        <div class="header_t flex">
            <div class="header_t_c flex">
                <div class="flex">动态信息知识库</div>
                <div>
                    <ul class="flex">
                        <li class="flex"><span class="flex home_page">首页</span></li>
                        <li class="flex"><span class="flex knowledge_page">知识库</span></li>
                        <li class="flex"><span class="flex">系统管理</span></li>
                        <!--<li class="flex"><span class="flex">登陆</span></li>-->
                        <li class="flex">
                            <i class="photo"></i><span class="flex name my_page">你好</span><i class="quit_btn flex">退出</i>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <div class="header_b flex"> </div>
    </div>
    <div class="bodyer flex">
        <div class="power">
            <div class="header_b_main flex">
            </div>
            <div class="flex content">
                <div class="power_l">
                    <div class="search">
                        <div class="search_title flex">
                            <i class="search_i_1"></i>
                            <span class="search_text">最近检索</span>
                        </div>
                        <div class="search_content">
                            <ul class="search_ul">

                            </ul>
                        </div>
                    </div>
                    <div class="browse">
                        <div class="browse_title flex">
                            <i class="search_i_1"></i>
                            <span class="search_text">最近浏览</span>
                        </div>
                        <div class="browse_content">
                            <ul class="browse_ul">

                            </ul>
                        </div>
                    </div>
                </div>
                <div class="power_r">
                    <div style="display:none" class="search_box">
                        <div class="search_box_t flex">
                            <div class="flex search_box_t_main">
                                <div class="select_box flex">
                                    <p type="keyword" id="search_type">主题</p>
                                    <i class="search_i_3"></i>
                                    <div class="select_content1">

                                    </div>
                                </div>
                                <div class="flex input_box">
                                    <input class="serch_inp" placeholder="请搜索要搜索的内容" type="text">
                                </div>
                                <div class="icon_1_box flex">
                                    <i class="icon_1"></i>
                                </div>
                            </div>
                            <div class="senior flex">高级检索<i class="icon_3"></i></div>
                        </div>
                        <div class="search_box_b flex">
                            <div class="vis_select"></div>
                            <ul class="flex" id="vis_select_ul">

                            </ul>
                        </div>
                    </div>

                    <div class="power_mian" style="display: none">
                        <div class="search_text" style="margin-left: 0px">请输入检索条件</div>
                        <div class="flex">
                            <div class="btn_box2">
                                <div class="flex">
                                    <button class="flex" type="add"><img src="../image/add_btn.png" alt=""></button>
                                    <button class="flex" type="reduce"><img src="../image/reduce_btn.png" alt=""></button>
                                </div>
                            </div>
                            <div class="btn_box3">
                                <ul class="btn_box3_ul">

                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="flex btn_box_" style="display: none"><div class="submit flex">检索</div><div class="common_btn flex">普通检索<i class="icon_3"></i></div></div>
                    <div class="btn_box">
                        <div class="title flex">
                            检索结果
                        </div>
                        <div class="flex btn_box_r">
                            <span>批量下载</span><i class="my_i_4 batch_down_btn"></i>
                        </div>
                    </div>
                    <div class="table_box">
                        <table cellspacing="0">
                            <thead>
                            <tr >
                                <th >文章标题</th>
                                <th >作者</th>
                                <th >发布时间</th>
                                <th>媒体源</th>
                                <th>国家</th>
                                <th>语种</th>
                                <th >知识库</th>
                                <th >下载</th>
                                <th >收藏</th>
                            </tr>
                            </thead>
                            <tbody class="tbody">

                            </tbody>
                        </table>
                    </div>
                    <div class="paging_box_">

                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
<script id="item_list_tem5" type="text/x-dot-template">
    {{~it:value:index}}
    <tr>
        <td>
            <div style="display: flex;justify-content: flex-start;align-items: center;width: 100%;padding:10px 0px">
                <input id_="{{=value.id}}" class="title_box_check" type="checkbox">
                <span class="title_box_" title="{{=value.title}}" id_="{{=value.id}}" style="cursor: pointer;text-align: left">{{=value.title}}</span>
            </div>
        </td>
        <td>
            <p title="{{=value.author}}">
                {{?value.author}}
                {{=value.author}}
                {{?}}
            </p>
        </td>
        <td>
            <p title="{{=value.pubDate}}">
                {{?value.pubDate}}
                {{=value.pubDate}}
                {{?}}
            </p>
        </td>
        <td>
            <p title="{{=value.organization}}">
                {{?value.organization}}
                {{=value.organization}}
                {{?}}
            </p>
        </td>
        <td>
            <p title="{{=value.mediaCountry}}">
                {{?value.mediaCountry}}
                {{=value.mediaCountry}}
                {{?}}
            </p>
        </td>
        <td>
            <p title="{{=value.langName}}">
                {{?value.langName}}
                {{=value.langName}}
                {{?}}
            </p>
        </td>
        <td>
            <p title="{{=value.classifyName}}">
                {{?value.classifyName}}
                {{=value.classifyName}}
                {{?}}
            </p>
        </td>
        <td>
            <div class="flex">
                <i class="icon6" id_="{{=value.id}}"></i>
            </div>
        </td>
        <td>
            <div class="flex">
                {{?value.collect}}
                <i class="icon4 collect" id_="{{=value.id}}" collect="true"></i>
                {{??}}
                <i class="icon5 collect" id_="{{=value.id}}" collect="false"></i>
                {{?}}
            </div>
        </td>
    </tr>
    {{~}}
</script>

<script id="item_list_tem" type="text/x-dot-template">
    {{~it:value:index}}
    <li class="flex search_item" word="{{=value.word}}"><i class="search_i_2"></i><span>{{=value.word}}</span></li>
    {{~}}
</script>

<script id="item_list_tem4" type="text/x-dot-template">
    {{~it:value:index}}
    <li class="flex"><i class="search_i_2"></i><span class="browser_item" id_="{{=value.id}}">{{=value.title}}</span></li>
    {{~}}
</script>

<script id="item_list_tem2" type="text/x-dot-template">
    {{~it:value:index}}
        {{?value.check}}
            <li class="flex"><input class="search_check" type="checkbox" checked="checked"  value="{{=value.id}}"><span>{{=value.name}}</span></li>
        {{??}}
            <li class="flex"><input class="search_check" type="checkbox" value="{{=value.id}}"><span>{{=value.name}}</span></li>
        {{?}}
    {{~}}
</script>

<script id="item_list_tem3" type="text/x-dot-template">
    {{~it:value:index}}
    <div type="{{=value.searchKey}}" class="select_content_item1">{{=value.searchLabel}}</div>
    {{~}}
</script>
<script id="item_list_tem1" type="text/x-dot-template">
    <li class="flex">
        <div class="flex">
            <div class="select_box flex">
                <p value="keyword" class="search_type1">全部</p>
                <i class="search_i_3"></i>
                <div class="select_content">
                    {{~it:value:index}}
                    <div value="{{=value.searchKey}}" type="item1" class="select_content_item">{{=value.searchLabel}}</div>
                    {{~}}
                </div>
            </div>
            <input type="item1" type="text">
        </div>
        <div>
            <div class="select_box flex">
                <p value="and" type="item2" class="search_type1">并含</p>
                <i class="search_i_3"></i>
                <div class="select_content">
                    <div value="and" type="item2" class="select_content_item">并含</div>
                    <div value="or" type="item2" class="select_content_item">或含</div>
                    <div value="un" type="item2" class="select_content_item">不含</div>
                </div>
            </div>
        </div>
        <div class="flex">
            <div class="select_box flex">
                <p value="keyword" class="search_type1">全部</p>
                <i class="search_i_3"></i>
                <div class="select_content">
                    {{~it:value:index}}
                    <div value="{{=value.searchKey}}" type="item3" class="select_content_item">{{=value.searchLabel}}</div>
                    {{~}}
                </div>
            </div>
            <input type="item3" type="text">
        </div>
    </li>
</script>
<script src="../js/jquery.min.js"></script>
<script src="../js/common.js"></script>
<script src="../js/doT.min.js"></script>
<script src="../js/url.js"></script>
<script>
    // var senior = null;
    var search_data =
            {
                "pageNo":"1",
                "pageSize":"20"
            },check_arr=[],selectTypes=null,type_arr=[],senior=false,batch_down={};
    $(function(){
        render_user();
        if(GetQueryString('search')&&GetQueryString('search')!=""){
            senior = true;
            $('.power_mian').css({"display":"block"})
            $('.btn_box_').css({"display":"flex"})
        }else{
            $('.search_box').css({"display":"block"});
            search_data.searchValue = decodeURI(GetQueryString('searchValue'));

            search_data.searchValue!="null"?$('.serch_inp').val(search_data.searchValue):'';
            search_data.searchKey = GetQueryString('searchKey');
            if(GetQueryString('classifyParents')){
                search_data.classifyParents = GetQueryString('classifyParents')
            }
            get_search_res()
        }
        get_page_data();

        document.onkeydown = function(e) {
            if (e.keyCode == 13) {
                if(senior){
                    senior_search()
                }else{
                    common_search()
                }
            }
        }

        $('.senior').on('click',function () {
            senior = true;
            search_data.pageNo = 1;
            search_data.searchValue = '';
            delete search_data.searchKey;
            delete search_data.classifyParents;

            $('.btn_box_').css({"display":"flex"});
            $('.power_mian').css({"display":"block"})
            $('.search_box').css({"display":"none"});
        })

        $('.common_btn').on('click',function () {
            senior = false;
            search_data.pageNo = 1;
            search_data.searchValue = '';
            delete search_data.searchKey;
            delete search_data.classifyParents;

            $('.power_mian,.btn_box_').css({"display":"none"})
            $('.search_box').css({"display":"block"});
        })


        $('body').on('click','.browser_item',function () {
            var id_ = $(this).attr('id_');
            url_jump('detail',{"id":id_})
        })

        $('body').on('click','.title_box',function () {
            var id_ = $(this).attr('id_');
            url_jump('detail',{"id":id_})
        })

        $('#search_type,.search_i_3').on('click',function () {
            $(this).parent().find('.select_content1').slideToggle();
        });

        $('body').on('click','.select_content_item1',function () {
            var type = $(this).attr("type")
            $('#search_type').text($(this).text()).attr({"type":type});
            $('.select_content1').slideToggle();
        });
        //复选
        $('body').on('change','.search_check',function () {
            var id = $(this).attr('value');
            if($(this).is(':checked')){
                check_arr.push(id)
            }else{
                arr_remove(check_arr,id)
            }
        })

        $('body').on('click','.icon6',function () {
            var id = $(this).attr('id_');
            downfile(id)
        })

        $('body').on('click','.collect',function () {
            var now_this = $(this);
            var collect = now_this.attr('collect')
            var id_ = now_this.attr('id_');
            if(collect=="true"){
                now_this.attr({'collect':'false'})
                cancelCollect(id_,function(){
                    now_this.css({
                        "background":"url(../image/icon_11.png)no-repeat",
                        "background-size":"cover"
                    })
                })
            }else{
                now_this.attr({'collect':'true'})
                saveCollect(id_,function(){
                    now_this.css({
                        "background":"url(../image/icon_16.png)no-repeat",
                        "background-size":"cover"
                    })
                })
            }
        });

        $('body').on('click','.select_content_item',function () {
            var value = $(this).attr('value');
            var text = $(this).text();
            $(this).parents('.select_box').find('.search_type1').text(text).attr({"value":value});
            $(this).parent('.select_content').slideToggle();


            var index = $(this).parents('li').index();
            var type = $(this).attr('type');
            type_arr[index][type]['type'] = value;

        });

        $('body').on('change','.btn_box3_ul input',function () {
            var value = $(this).val();
            var index = $(this).parents('li').index();
            var type = $(this).attr('type')
            type_arr[index][type]['inp'] = value;
        })

        $('body').on('click','.btn_box2>div>button',function () {
            var type = $(this).attr('type');
            var str = '<div class="flex"><button class="flex" type="add"><img src="../image/add_btn.png" alt=""></button>' +
                '<button class="flex" type="reduce"><img src="../image/reduce_btn.png" alt=""></button>' +
                '</div>'
            if(type=="add"){
                $('.btn_box2').append(str)
                render_li();

            }else{
                $('.btn_box2>div:last-child').remove();
                var target_len = $('.btn_box3_ul').children().length;
                if(target_len>1){
                    $('.btn_box3_ul>li').eq((target_len-1)).remove();
                    type_arr.pop();
                }
            }
        });

        $('body').on('click','.submit',senior_search)

        $('body').on('click','.search_type1,.search_i_3',function () {
            $(this).parent().find('.select_content').slideToggle();
        });


        $('body').on('change','.title_box_check',function(){
            var that = $(this);
            if(that.is(':checked')){
                batch_down[that.attr('id_')] = true
            }else{
                delete batch_down[that.attr('id_')]
            }
        })

        $('.batch_down_btn').on('click',function(){
            var batch_down_arr = []
            for(var i in batch_down){
                batch_down_arr.push(i)
            }
            if(batch_down_arr.length>0){
                downfile(batch_down_arr.join(','))
            }else{
                s_warning('请选择需要下载的文件');
            }
        })

        //搜索
        $('.icon_1_box').on('click',common_search)



        $('body').on('click','.search_item',function () {
            var word = $(this).attr('word');
            search_data.pageNo = 1;
            search_data.searchValue = word;
            search_data.searchKey = 'keyword';
            delete search_data.classifyParents;
            get_search_res();
        });


    })

    function common_search(){
        var value = $('.serch_inp').val();
        if(value==""){
            s_warning('请输入搜索内容');
            return
        }
        search_data.pageNo = 1;
        search_data.searchValue = value;
        search_data.searchKey = $('#search_type').attr("type");
        check_arr.length>0?search_data.classifyParents=check_arr.join(','):delete search_data.classifyParents;
        get_search_res()
    }
    function senior_search(){
        var str = '';
        for(var i=0;i<type_arr.length;i++){
            str+='+('+type_arr[i].item1.type+':'+type_arr[i].item1.inp+')';
            if(type_arr[i].item2.type=="and"){
                str+='+';
            }else if(type_arr[i].item2.type=="or"){
                str+='|';
            }else{
                str+='-';
            }
            str+='('+type_arr[i].item3.type+':'+type_arr[i].item3.inp+')';
        }
        search_data.searchValue = str;
        get_search_res()
    }

    function get_search_res() {
        var option = option_structure([
            {
                "method" : "post",
                "url" : ajax_url.simpleSearch,
                "data" : search_data
            }
        ]);
        var back = callback_structure([
            function (res) {
                judge_data(res.data,function (data) {
                    for(var i=0;i<data.length;i++){
                        if(data[i].pubDate){
                            var ti = data[i].pubDate.split(' ')[0].replace(/-/g,'/');
                            data[i].pubDate = ti
                        }
                    }
                    $('.tbody').empty();
                    batch_down = {};
                    doT_render('.tbody','#item_list_tem5',data);
                    search_data.pageNo = res.pageNo;
                    search_data.totalPage = res.totalPage;
                    search_data.total = res.total;
                    paging_render('.paging_box_',search_data)
                })
            }
        ]);
        pro_all(option,back)
    }

    function render_li(){
        type_arr.push({
            "item1":{"type":"keyword","inp":""},
            "item2":{"type":"and"},
            "item3":{"type":"keyword","inp":""}
        })
        doT_render('.btn_box3_ul','#item_list_tem1',selectTypes);
    }


    function get_page_data() {
        var option = option_structure([
            {
                "method" : "post",
                "url" : ajax_url.latestBrowserHis,
                "data":{"pageSize":"4"}
            },
            {
                "method" : "post",
                "url" : ajax_url.latestSearchHis,
                "data":{"pageSize":"4"}
            }
            ,
            {
                "method" : "get",
                "url" : ajax_url.searchTypes
            },
            {
                "method":"get",
                "url":ajax_url.classifyTree+'?id=0'
            }
        ]);
        var back = callback_structure([
            function (res) {
                judge_data(res,function (data) {
                    doT_render('.browse_ul','#item_list_tem4',data);
                })
            },
            function (res) {
                judge_data(res,function (data) {
                    var arr_ = [];
                    for(var i=0;i<data.length;i++){
                        if(data[i].word!=""){
                            arr_.push(data[i])
                        }
                    }
                    doT_render('.search_ul','#item_list_tem',arr_);
                })
            },
            function (res) {
                judge_data(res.selectTypes,function (data) {
                    selectTypes = res.selectTypes;
                    doT_render('.select_content1','#item_list_tem3',data);
                    render_li()
                })
            },
            function (res) {
                judge_data(res,function (data) {
                    if(search_data.classifyParents){
                        var arr_ = search_data.classifyParents.split(',');
                        data.map(function(item){
                            arr_.map(function(item2){
                                if(Number(item.id)==Number(item2)){
                                    item.check = true
                                }
                            })
                        })
                    }
                    doT_render('#vis_select_ul','#item_list_tem2',data);
                })
            }
        ]);
        pro_all(option,back)
    }
</script>
</body>
</html>